<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
 * Created on 2012-7-8
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 class category_m extends CI_Model{
 	private $TB = 'category';
 	function __construct(){
 		parent::__construct();
 	}
 	/*
 	 * 根据$where 查询$need
 	 */
	function get_where($need,$where){
		if(is_array($need)){
			$need = implode(',',$need);
		}
		$query = $this->db->select($need)
							->from($this->TB)
							->where($where)
							->get();
		return $query;

	}
	function get_id_by_alias($alias){
		$query = $this->db->select('cid')
						->from($this->TB)
						->where(array('alias'=>$alias))
						->get();
		return $query;
	}
	function get_categoryname_by_alias($alias){
		$query = $this->db->select('categoryname')
						->from($this->TB)
						->where(array('alias'=>$alias))
						->get();
		return $query;
	}
 }
?>
